//
//  EXT+UIButton.swift
//  Swift---新浪微博练习代码
//
//  Created by Mr.Yan on 2017/6/30.
//  Copyright © 2017年 Mr.Yan. All rights reserved.
//

import UIKit
extension UIButton{

    //文字 及 背景图片
    
    convenience init(title: String?, fontSize: CGFloat, normalColor: UIColor, highlightedColor: UIColor, backgroundImgName: String, target: Any?, action: Selector){
    
        self.init()
        self.addTarget(target, action: action, for: UIControlEvents.touchUpInside)
        self.setTitle(title, for: UIControlState.normal)
        self.setTitleColor(normalColor, for: UIControlState.normal)
        self.setTitleColor(highlightedColor, for: UIControlState.highlighted)
        self.titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
        self.setBackgroundImage(UIImage.resizableImage(named: backgroundImgName), for: UIControlState.normal)
    
    }


}
